//! Command types for controlling the group handler.

use openmls::framing::ProtocolMessage;

/// Command to perform on a group's state.
pub enum Command {
    /// MLS protocol message, received from somewhere.
    ProcMessage(ProtocolMessage),

    /// Outbound message should be signed.
    SendMessage(MessageData),
}

/// Outbound message to sign+encrypt and send.
pub struct MessageData {
    application_payload: Vec<u8>,
}

impl MessageData {
    pub fn new(application_payload: Vec<u8>) -> Self {
        Self {
            application_payload,
        }
    }

    pub fn application_payload(&self) -> &[u8] {
        &self.application_payload
    }

    pub fn into_application_payload(self) -> Vec<u8> {
        self.application_payload
    }
}
